-
Notifications
You must be signed in to change notification settings - Fork 33
[C-655] add chainlink data streams oracle #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…71. Includes support for the new Chainlink oracle messages.
WalkthroughThis PR updates the injective-indexer repository version, regenerates protobuf files with modified descriptor layouts and new messages, renames the Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~55 minutes Possibly related PRs
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for Chainlink Data Streams oracle integration to the Injective Python SDK. The changes primarily update protobuf-generated files to include new Chainlink Data Streams-related messages and fields, along with renaming fields in the permissions module from contract_hook to wasm_hook and adding evm_hook support.
Key Changes:
- Added Chainlink Data Streams oracle price state and relay message support
- Renamed
contract_hooktowasm_hookand addedevm_hookin permissions module - Added new position fields (
cumulative_funding_entry,effective_cumulative_funding_entry) - Added
has_disabled_minimal_protocol_feefield to market structures - Updated version to 1.13.0-rc1
Reviewed changes
Copilot reviewed 52 out of 53 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Version bump to 1.13.0-rc1 |
| pyinjective/proto/injective/oracle/v1beta1/*.py | Added Chainlink Data Streams oracle support with new message types and query endpoints |
| pyinjective/proto/injective/permissions/v1beta1/*.py | Renamed contract_hook to wasm_hook, added evm_hook field |
| pyinjective/proto/injective/exchange/v2/*.py | Added has_disabled_minimal_protocol_fee field to market proposals and queries |
| tests/*.py | Updated tests to use new wasm_hook/evm_hook naming and added new position fields |
| pyinjective/proto/google/iam/v1/*.py | Added new Google IAM policy proto files |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pyinjective/composer_v2.py (2)
249-252: Fix GRPC response map forMsgRelayProviderPricesResponse.
GRPC_RESPONSE_TYPE_TO_CLASS_MAPmaps the type URL forMsgRelayProviderPricesResponseto the request classMsgRelayProviderPricesinstead of the corresponding response class. This will causeComposer.MsgResponses/unpack_msg_exec_responseto deserialize those responses into the wrong message type.Proposed fix
- "/injective.oracle.v1beta1.MsgRelayProviderPricesResponse": - injective_oracle_tx_pb.MsgRelayProviderPrices, + "/injective.oracle.v1beta1.MsgRelayProviderPricesResponse": + injective_oracle_tx_pb.MsgRelayProviderPricesResponse,
1579-1584: Return type annotation does not match actual return value.
chain_stream_oracle_price_filteris annotated to returnPositionsFilterbut actually returnsOraclePriceFilter. This will confuse type checkers and readers.Proposed fix
- def chain_stream_oracle_price_filter( - self, - symbols: Optional[List[str]] = None, - ) -> chain_stream_v2_query.PositionsFilter: + def chain_stream_oracle_price_filter( + self, + symbols: Optional[List[str]] = None, + ) -> chain_stream_v2_query.OraclePriceFilter:
🧹 Nitpick comments (1)
pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (1)
14-25: OracleList RPC wiring is correct; consider tidying stub assignment
fetch_oracle_listnow correctly builds anOracleListRequestwithsymbolandoracle_typeand passes it to_stub.OracleListvia_execute_call, consistent with the other RPC helpers. As a tiny cleanup while you’re here, you can drop the redundantself._stub = self._stub = ...assignment in__init__and just assign once.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
poetry.lockis excluded by!**/*.lock
📒 Files selected for processing (52)
Makefilebuf.gen.yamlexamples/chain_client/permissions/1_MsgCreateNamespace.pyexamples/chain_client/permissions/2_MsgUpdateNamespace.pyexamples/exchange_client/oracle_rpc/3_OracleList.pypyinjective/async_client.pypyinjective/client/indexer/grpc/indexer_grpc_oracle_api.pypyinjective/composer.pypyinjective/composer_v2.pypyinjective/indexer_client.pypyinjective/ofac.jsonpyinjective/orderhash.pypyinjective/proto/exchange/event_provider_api_pb2.pypyinjective/proto/exchange/injective_archiver_rpc_pb2.pypyinjective/proto/exchange/injective_auction_rpc_pb2.pypyinjective/proto/exchange/injective_auction_rpc_pb2_grpc.pypyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.pypyinjective/proto/exchange/injective_megavault_rpc_pb2.pypyinjective/proto/exchange/injective_oracle_rpc_pb2.pypyinjective/proto/exchange/injective_portfolio_rpc_pb2.pypyinjective/proto/google/api/routing_pb2.pypyinjective/proto/google/api/routing_pb2_grpc.pypyinjective/proto/google/iam/v1/iam_policy_pb2.pypyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.pypyinjective/proto/google/iam/v1/options_pb2.pypyinjective/proto/google/iam/v1/options_pb2_grpc.pypyinjective/proto/google/iam/v1/policy_pb2.pypyinjective/proto/google/iam/v1/policy_pb2_grpc.pypyinjective/proto/injective/exchange/v1beta1/exchange_pb2.pypyinjective/proto/injective/exchange/v1beta1/query_pb2.pypyinjective/proto/injective/exchange/v2/market_pb2.pypyinjective/proto/injective/exchange/v2/proposal_pb2.pypyinjective/proto/injective/exchange/v2/query_pb2.pypyinjective/proto/injective/oracle/v1beta1/events_pb2.pypyinjective/proto/injective/oracle/v1beta1/genesis_pb2.pypyinjective/proto/injective/oracle/v1beta1/oracle_pb2.pypyinjective/proto/injective/oracle/v1beta1/query_pb2.pypyinjective/proto/injective/oracle/v1beta1/query_pb2_grpc.pypyinjective/proto/injective/oracle/v1beta1/tx_pb2.pypyinjective/proto/injective/oracle/v1beta1/tx_pb2_grpc.pypyinjective/proto/injective/permissions/v1beta1/params_pb2.pypyinjective/proto/injective/permissions/v1beta1/permissions_pb2.pypyinjective/proto/injective/permissions/v1beta1/tx_pb2.pypyproject.tomltests/client/chain/grpc/test_chain_grpc_exchange_v2_api.pytests/client/chain/grpc/test_chain_grpc_permissions_api.pytests/client/indexer/grpc/test_indexer_grpc_derivative_api.pytests/client/indexer/grpc/test_indexer_grpc_oracle_api.pytests/client/indexer/grpc/test_indexer_grpc_portfolio_api.pytests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.pytests/test_composer.pytests/test_composer_v2.py
🧰 Additional context used
🧬 Code graph analysis (7)
pyinjective/indexer_client.py (2)
pyinjective/async_client.py (1)
fetch_oracle_list(1297-1300)pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (1)
fetch_oracle_list(18-27)
tests/client/indexer/grpc/test_indexer_grpc_oracle_api.py (3)
pyinjective/async_client.py (1)
fetch_oracle_list(1297-1300)pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (1)
fetch_oracle_list(18-27)pyinjective/indexer_client.py (1)
fetch_oracle_list(662-665)
pyinjective/async_client.py (2)
pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (1)
fetch_oracle_list(18-27)pyinjective/indexer_client.py (1)
fetch_oracle_list(662-665)
pyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.py (1)
pyinjective/core/network.py (1)
metadata(20-25)
examples/exchange_client/oracle_rpc/3_OracleList.py (3)
pyinjective/async_client.py (1)
fetch_oracle_list(1297-1300)pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (1)
fetch_oracle_list(18-27)pyinjective/indexer_client.py (1)
fetch_oracle_list(662-665)
pyinjective/proto/injective/oracle/v1beta1/tx_pb2_grpc.py (1)
pyinjective/core/network.py (1)
metadata(20-25)
pyinjective/client/indexer/grpc/indexer_grpc_oracle_api.py (2)
pyinjective/async_client.py (1)
fetch_oracle_list(1297-1300)pyinjective/indexer_client.py (1)
fetch_oracle_list(662-665)
🪛 Ruff (0.14.10)
pyinjective/proto/injective/oracle/v1beta1/query_pb2_grpc.py
184-184: Unused method argument: request
(ARG002)
pyinjective/proto/exchange/injective_auction_rpc_pb2_grpc.py
104-104: Unused method argument: request
(ARG002)
pyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.py
88-88: Unused method argument: request
(ARG002)
98-98: Unused method argument: request
(ARG002)
107-107: Unused method argument: request
(ARG002)
pyinjective/proto/injective/oracle/v1beta1/tx_pb2_grpc.py
122-122: Unused method argument: request
(ARG002)
🔇 Additional comments (60)
pyinjective/proto/injective/oracle/v1beta1/tx_pb2.py (1)
48-49: Auto-generated protobuf code looks correct.The new
MsgRelayChainlinkPricesandMsgRelayChainlinkPricesResponsedescriptors are properly registered with correct serialized options and sequential, non-overlapping byte ranges. The pattern matches other oracle relay messages (e.g.,MsgRelayPythPrices).Also applies to: 86-95
pyinjective/proto/injective/oracle/v1beta1/tx_pb2_grpc.py (4)
53-57: LGTM!The client stub correctly registers the new
RelayChainlinkPricesRPC with appropriate request serializer and response deserializer, following the established pattern of other relay methods.
122-128: Servicer interface correctly defined; static analysis hint is a false positive.The
requestargument is part of the gRPC servicer method signature contract. All other servicer methods in this file follow the identical pattern where the base implementation raisesNotImplementedError. The unused argument warning can be safely ignored for interface/base class methods.
175-179: Server registration correctly wired.The method handler uses appropriate deserializer (
MsgRelayChainlinkPrices.FromString) for requests and serializer (MsgRelayChainlinkPricesResponse.SerializeToString) for responses, consistent with the other relay methods.
386-411: Experimental API method correctly added.The static
RelayChainlinkPricesmethod follows the same pattern as other experimental API methods with proper RPC path, serializers, and parameter handling.pyproject.toml (1)
3-3: LGTM! Appropriate version bump for new features.The version bump to 1.13.0-rc1 correctly reflects a minor version increment with a release candidate designation, which is appropriate for introducing new Chainlink Data Streams oracle support.
pyinjective/proto/injective/oracle/v1beta1/genesis_pb2.py (1)
19-19: LGTM! Standard protobuf descriptor realignment.The descriptor boundary adjustments are auto-generated changes that reflect upstream protobuf schema modifications. No functional changes to the public API.
Also applies to: 32-34
pyinjective/proto/google/iam/v1/policy_pb2_grpc.py (1)
1-4: LGTM! Standard generated gRPC stub boilerplate.This is a new auto-generated gRPC Python stub file with the expected header. Part of the broader IAM v1 policy integration.
pyinjective/ofac.json (1)
36-36: LGTM! OFAC sanctioned address additions for compliance.Three new addresses have been added to the OFAC sanctions list. All addresses are properly formatted in lowercase hexadecimal. These additions are important for maintaining regulatory compliance.
Also applies to: 62-62, 72-72
pyinjective/proto/injective/permissions/v1beta1/tx_pb2.py (1)
68-82: LGTM! Descriptor offset realignment from upstream proto changes.The serialized offset adjustments reflect the upstream protobuf schema changes related to the namespace hook field updates (contract_hook → wasm_hook, addition of evm_hook). These are standard auto-generated changes with no functional impact.
buf.gen.yaml (1)
19-19: Clarify the cometbft downgrade and consider using v1.0.1-inj.5.The downgrade from v1.0.1-inj.4 (released Oct 14) to v1.0.1-inj.3 (released Oct 13) needs justification. A newer version, v1.0.1-inj.5 (released Dec 16), is available. Provide:
- Reason for downgrading v1.0.1-inj.4 (critical bug, compatibility issue, etc.)
- Why v1.0.1-inj.5 was not chosen instead
- Confirmation that this downgrade doesn't reintroduce previously fixed issues
pyinjective/proto/injective/exchange/v1beta1/query_pb2.py (1)
239-239: Proto file auto-generated from upstream chain definitions—no action required for SDK.This file is auto-generated from the Injective chain v1.18.0 proto definitions. Proto HTTP path annotations are metadata used by REST gateways, not by the SDK's gRPC-based client code. The SDK clients call gRPC methods by name (e.g.,
self._stub.SubaccountPositions), which remain stable. No breaking changes to SDK functionality.Makefile (1)
29-29: Remove the unsupported Chainlink Data Streams support claim for v1.17.71.The v1.17.71 tag exists in the injective-indexer repository; however, it introduces "filters to oracle list endpoint" and contains no Chainlink Data Streams references. Verify that this version aligns with the actual requirements of the PR rather than assuming Chainlink support based on the version bump.
Likely an incorrect or invalid review comment.
pyinjective/proto/injective/oracle/v1beta1/events_pb2.py (1)
1-64: Auto-generated protobuf code looks correct.The new
_EVENTSETCHAINLINKDATASTREAMSPRICESdescriptor is properly added with sequential serialized offsets (1595-1713) following the existing_EVENTSETPYTHPRICESdescriptor (1507-1593). The naming convention is consistent with other oracle event types.pyinjective/proto/exchange/injective_oracle_rpc_pb2.py (1)
25-52: Auto-generated descriptor offset updates are consistent.The serialized offset updates for all message descriptors follow the expected monotonically increasing pattern. These are standard metadata changes from protobuf regeneration.
pyinjective/proto/google/api/routing_pb2.py (1)
1-30: New Google API routing protobuf module follows standard generation patterns.The file correctly implements the protobuf Python module structure with proper descriptor pool initialization, message/enum descriptor building, and conditional C-descriptor handling. The serialized offsets for
RoutingRuleandRoutingParameterare sequential.pyinjective/proto/google/api/routing_pb2_grpc.py (1)
1-4: Minimal gRPC stub is expected.The
routing.protofile defines only message types (RoutingRule,RoutingParameter) without RPC services, so the generated gRPC module correctly contains only the import statement and docstring.pyinjective/proto/exchange/event_provider_api_pb2.py (1)
42-76: Auto-generated descriptor offset updates are consistent.The serialized offset updates maintain proper sequential ordering across all message descriptors. This is standard metadata adjustment from protobuf regeneration.
pyinjective/proto/exchange/injective_derivative_exchange_rpc_pb2.py (1)
98-178: Auto-generated descriptor offset updates are consistent.All serialized offset updates for the derivative exchange RPC message descriptors maintain proper sequential ordering without overlaps. This is standard metadata from protobuf regeneration.
pyinjective/proto/injective/permissions/v1beta1/permissions_pb2.py (1)
19-48: Schema update for Namespace message correctly reflected.The generated protobuf code properly reflects the schema changes:
- Field renamed:
contract_hook→wasm_hook(field number 2)- New field added:
evm_hook(field number 8)The serialized descriptor and offset metadata are consistent with these schema changes.
pyinjective/proto/google/iam/v1/policy_pb2.py (2)
40-45: Shared enum offset range is intentional.Lines 40-41 and 44-45 show
_BINDINGDELTA_ACTIONand_AUDITCONFIGDELTA_ACTIONsharing the same serialized offset range (1012-1065). This is valid protobuf behavior when both enums have identical definitions (both defineACTION_UNSPECIFIED,ADD,REMOVE), allowing the compiler to deduplicate them in the serialized representation.
1-46: New Google IAM policy protobuf module follows standard generation patterns.The file correctly implements the protobuf Python module structure with proper descriptor pool initialization, message/enum descriptor building, and conditional C-descriptor handling. All message types (
Policy,Binding,AuditConfig,AuditLogConfig,PolicyDelta,BindingDelta,AuditConfigDelta) are properly defined with sequential offsets.pyinjective/orderhash.py (1)
13-17: Approve the OrderInfo model migration to Pydantic BaseModel.The migration from EIP712Type to Pydantic BaseModel with
abi.stringtyped fields is clean and follows modern patterns for typed data structures.pyinjective/composer.py (2)
1625-1650: API parameter rename: contract_hook → wasm_hook and new evm_hook.The parameter rename from
contract_hooktowasm_hookwith the addition ofevm_hooksupport is implemented correctly inmsg_create_namespace. Ensure all callers have been updated to use the new parameter names.
1663-1664: No changes needed. The code correctly usesSetContractHookfor bothwasm_hookandevm_hookbecause the protobuf definition specifies that both fields have the same message type:MsgUpdateNamespace.SetContractHook. There is no separateSetEvmHookwrapper in the schema—the protobuf intentionally uses a single reusable wrapper type for both hooks.pyinjective/proto/exchange/injective_archiver_rpc_pb2.py (1)
1-91: Generated protobuf file - no action required.This is an auto-generated protobuf file with only internal descriptor offset adjustments. The changes are expected when regenerating protobuf definitions and do not require manual review.
tests/client/indexer/grpc/test_indexer_grpc_oracle_api.py (1)
37-37: Test updated to exercise oracle list filtering.The test now correctly exercises the new optional
symbolandoracle_typefiltering parameters added tofetch_oracle_list. This aligns with the API changes across the client layers.pyinjective/proto/google/iam/v1/options_pb2_grpc.py (1)
1-4: Generated gRPC stub file - placeholder.This is an auto-generated gRPC stub file that currently only contains the module header and import. It appears to be a scaffold added as part of IAM v1 integration. No action required for generated code.
examples/exchange_client/oracle_rpc/3_OracleList.py (1)
12-12: Example updated to demonstrate oracle list filtering.The example now demonstrates the new optional filtering capability with
symbol="TIA"andoracle_type="provider". This provides users with a clear example of how to use the enhanced API.tests/client/indexer/grpc/test_indexer_grpc_portfolio_api.py (1)
52-53: Test updated for new funding entry fields.The test correctly includes and validates the new
cumulative_funding_entryandeffective_cumulative_funding_entryfields added to theDerivativePositionmessage. The test data and assertions are consistent.Also applies to: 115-116
examples/chain_client/permissions/2_MsgUpdateNamespace.py (1)
75-84: Example updated for wasm_hook/evm_hook API changes.The example correctly demonstrates the renamed
wasm_hookparameter (previouslycontract_hook) and the new optionalevm_hookparameter. The empty string forevm_hookshows users it can be left empty when not needed.examples/chain_client/permissions/1_MsgCreateNamespace.py (1)
91-101: Example correctly updated for wasm_hook / evm_hook APIThe example now uses the new
wasm_hookandevm_hookparameters inmsg_create_namespace, aligned with the updated Composer signature; using empty strings as “no hook” values is consistent and non‑breaking.pyinjective/indexer_client.py (1)
662-665: Oracle list filters correctly propagated in IndexerClient
fetch_oracle_listnow exposessymbolandoracle_typeand cleanly forwards them tooracle_api.fetch_oracle_list, consistent with the rest of the indexer client wrapper methods.pyinjective/async_client.py (1)
1297-1300: AsyncClient wrapper for oracle list matches indexer clientThe new
fetch_oracle_listmethod correctly mirrors theIndexerClientsignature and simply forwardssymbolandoracle_type, which is consistent with other AsyncClient pass‑through methods.pyinjective/proto/injective/permissions/v1beta1/params_pb2.py (1)
21-32: Params proto regeneration for contract_hook_max_gas looks consistentThe
DESCRIPTORblob and_PARAMSmetadata reflect the renamedcontract_hook_max_gasfield and updated layout; this appears to be standard protoc output with no manual logic to review.pyinjective/proto/injective/exchange/v2/market_pb2.py (1)
17-21: Market proto regeneration with new TWAP cumulative fields looks correctThe regenerated
market_pb2adds the expected TWAP cumulative price fields toExpiryFuturesMarketInfoand updates the associatedLegacyDecfield options and descriptor offsets; given this is protoc‑generated metadata, it looks consistent with an updated.protoschema.Also applies to: 104-151
tests/test_composer_v2.py (1)
1775-1911: Namespace hook tests accurately cover wasm_hook and evm_hook semanticsThe updated namespace tests now validate both creation (
namespace.wasmHook/namespace.evmHookas plain strings) and update (wasmHook/evmHookwrapped innewValuepatch objects), which matches the expected JSON shape from the new proto fields and Composer API.Also applies to: 1913-2033
pyinjective/proto/google/iam/v1/options_pb2.py (1)
1-27: New google.iam.v1 GetPolicyOptions proto module is standard and safeThis file is standard generated code for
GetPolicyOptions(withrequested_policy_version) and follows the usual protobuf pattern; there’s no hand‑written logic and nothing problematic from a consumer perspective.pyinjective/composer_v2.py (1)
1694-1715: Namespace wasm/evm hooks wiring looks consistent.The additions of
wasm_hookandevm_hooktomsg_create_namespaceandmsg_update_namespacecorrectly populate the newNamespacefields and the update wrapper messages, and they align with the updated tests (JSONwasmHook/evmHookexpectations).Also applies to: 1721-1744
tests/client/indexer/stream_grpc/test_indexer_grpc_derivative_stream.py (1)
325-342: New cumulative funding fields in streamed positions are wired correctly.For both
DerivativePositionandDerivativePositionV2, the tests now initializecumulative_funding_entry/effective_cumulative_funding_entryand assert the corresponding JSON keyscumulativeFundingEntry/effectiveCumulativeFundingEntry. The expectations match the proto field names and existing funding fields.Also applies to: 370-387, 810-826, 857-873
tests/client/chain/grpc/test_chain_grpc_permissions_api.py (2)
27-39: Module params rename tocontractHookMaxGasis consistent.Tests now build
Params(contract_hook_max_gas=...)and expectcontractHookMaxGasin JSON for both direct params and module state. This matches the typical camelCase conversion of the new proto field.Also applies to: 466-469, 520-525
89-99: Permissions namespacewasmHook/evmHookexpectations are coherent.The namespace fixtures now set
wasm_hookandevm_hook, and all related expectations (fetch_namespaces,fetch_namespace, andfetch_permissions_module_state) assertwasmHookandevmHookin the JSON output. This matches the updated namespace schema and the composer tests.Also applies to: 105-151, 181-191, 197-241, 493-503, 528-565
tests/test_composer.py (2)
1587-1651: Create-namespace test correctly covers new wasm/evm hooks.
test_msg_create_namespacenow passes bothwasm_hookandevm_hooktomsg_create_namespaceand asserts that the serialized namespace haswasmHookandevmHookpopulated with the same values alongside existing role/policy fields. This gives good coverage of the new hook fields.Also applies to: 1653-1717
1727-1781: Update-namespace test validates hook update wrapper messages.
test_msg_update_namespaceasserts thatwasmHookandevmHookin the update message are objects with anewValuefield carrying the passed hooks. This matches theSetContractHook-style wrapper used in the composer and provides solid regression coverage for future schema changes.Also applies to: 1783-1840
pyinjective/proto/injective/oracle/v1beta1/query_pb2_grpc.py (1)
68-72: Chainlink Data Streams RPC is wired consistently across client and server stubs.The new
ChainlinkDataStreamsPriceStatesmethod is correctly added to the stub, servicer, server registration, and experimentalQuerystatic API, all using the matching request/response types and the expected RPC path. This looks ready for server-side implementation.Also applies to: 184-190, 289-293, 611-637
tests/client/indexer/grpc/test_indexer_grpc_derivative_api.py (1)
625-642: Additional funding-entry fields are correctly propagated in derivative position APIs.The tests for
fetch_positions,fetch_positions_v2, andfetch_liquidable_positionsnow includecumulative_funding_entryandeffective_cumulative_funding_entryin fixtures and assert the matching camelCase keys in the JSON output. This aligns with the extended proto schema and ensures the new data is exposed in all relevant endpoints.Also applies to: 668-687, 705-721, 747-765, 783-800, 815-834
tests/client/chain/grpc/test_chain_grpc_exchange_v2_api.py (2)
465-498: LGTM!The
has_disabled_minimal_protocol_feefield is correctly added to the SpotMarket test data and expectation. The pattern is consistent across all market types.
1784-1806: LGTM!The new
expiration_twap_start_base_cumulative_priceandexpiration_twap_start_quote_cumulative_pricefields are correctly added to both the test input and expected output, with proper camelCase naming in the serialized form.pyinjective/proto/injective/oracle/v1beta1/query_pb2.py (1)
65-66: LGTM!The new
ChainlinkDataStreamsPriceStatesRPC is correctly added with proper HTTP annotation (/injective/oracle/v1beta1/chainlink_data_stream_price_states) and the request/response message descriptors are properly registered. This aligns with the PR objective of adding Chainlink Data Streams oracle support.Also applies to: 125-128
pyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.py (2)
88-118: Static analysis hints are false positives for generated servicer stubs.The unused
requestarguments flagged by Ruff (lines 88, 98, 107) are expected in gRPC servicer base classes. These methods are intentionally unimplemented stubs that define the interface contract - they're meant to be overridden in subclasses whererequestwill be used.
121-142: LGTM!The
add_IAMPolicyServicer_to_serverfunction correctly registers all three RPC method handlers with appropriate request deserializers and response serializers. This follows standard gRPC Python patterns.pyinjective/proto/google/iam/v1/iam_policy_pb2.py (1)
19-20: These import paths are correct and intentional. The generated protobuf files properly distinguish between locally vendored protos (pyinjective.proto.google.api.*) and Google's standard packages (google.iam.v1.*,google.type.*,google.protobuf.*). This pattern is consistent with how protoc generates files and is not an error. TheLikely an incorrect or invalid review comment.
pyinjective/proto/exchange/injective_portfolio_rpc_pb2.py (1)
17-58: New cumulative funding fields onDerivativePositionlook protobuf‑compatible
DerivativePositionnow includescumulative_funding_entryandeffective_cumulative_funding_entry, appended at the end of the message, with the rest of the change being descriptor offset realignment. That’s a backward‑compatible protobuf extension and matches existing decimal‑as‑string patterns used elsewhere in the schema.pyinjective/proto/injective/exchange/v2/query_pb2.py (1)
24-247: REST endpoint paths for positions queries have changed; verify client impact
Query.PositionsInMarketandQuery.SubaccountPositionsnow map to/injective/exchange/v2/positions_in_market/{market_id}and/injective/exchange/v2/subaccount_positions/{subaccount_id}respectively (previously under the generic/positions/...paths). gRPC wire compatibility is preserved, but any REST/grpc‑gateway clients hard‑coding the old URLs will break and must be updated together with documentation and examples.pyinjective/proto/exchange/injective_auction_rpc_pb2.py (1)
17-80: AuctionAccountStatus RPC and messages are wired consistently
AuctionAccountStatusRequest/Responseand theInjectiveAuctionRPC.AuctionAccountStatusRPC are added in the descriptor with consistent naming and message usage; the rest is start/end offset shuffling. This is a clean additive API surface, with the usual requirement that servers implement the new RPC rather than leaving the default UNIMPLEMENTED stub.pyinjective/proto/injective/exchange/v1beta1/exchange_pb2.py (1)
21-438: OpenNotionalCap option updates are metadata‑only and safeThe only semantic change is that
OpenNotionalCap.uncapped/cappednow carry explicitOpenNotionalCapUncapped/OpenNotionalCapCappedtype options; all other edits are_serialized_start/_serialized_endrealignments. This does not affect protobuf wire format and should be transparent to existing clients.pyinjective/proto/injective/oracle/v1beta1/oracle_pb2.py (1)
20-129: Chainlink Data Streams oracle extensions are added in a wire‑compatible way
Paramsnow exposes Chainlink Data Streams config (verifier proxy, acceptance flag, gas limit),ChainlinkDataStreamsPriceStateis added, andOracleTypegains aChainlinkDataStreamsvariant, withprice_stateoptions matching other price‑state messages. All additions are backward‑compatible (new fields and a new enum value at the tail), and they align with the goal of integrating Chainlink Data Streams oracle prices.pyinjective/proto/exchange/injective_megavault_rpc_pb2.py (1)
17-96: Megavault descriptor updates are purely structuralThe
_USER…_HISTORICALPNLdescriptor indices are re‑based and_OPERATIONSTATUSLOGENTRYnow has explicit_serialized_start/_serialized_endentries. Message and RPC schemas themselves are unchanged, so this is effectively a no‑risk regeneration of the megavault proto bindings.pyinjective/proto/exchange/injective_auction_rpc_pb2_grpc.py (1)
43-352:AuctionAccountStatusgRPC wiring is consistent; ignore the unused-arg lint on the base servicerThe new
AuctionAccountStatusRPC is correctly added to:
- the client stub,
- the servicer interface,
- server registration, and
- the EXPERIMENTAL static client, all using the same path and request/response types as in the proto.
The Ruff
ARG002on therequestargument inInjectiveAuctionRPCServicer.AuctionAccountStatusis expected for an unimplemented base method; concrete servicer implementations will consumerequest, so no change is needed here.pyinjective/proto/injective/exchange/v2/proposal_pb2.py (1)
26-249: Tri‑state minimal‑protocol‑fee flag is added consistently across proposal types
DisableMinimalProtocolFeeUpdate(NoUpdate/False/True) plus thehas_disabled_minimal_protocol_feefield on spot, derivative, and binary‑options param‑update proposals give you a proper tri‑state “no change / explicitly disable / explicitly enable” control for the minimal protocol fee. The new enum and fields are added in a protobuf‑compatible way and wired consistently via field options and descriptor indices; any client logic consuming these proposals just needs to honor the tri‑state semantics correctly.
| branch: c-655/add_chainlink_data_streams_oracle | ||
| subdir: proto |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Replace branch reference with tagged release or commit SHA.
Using a feature branch (c-655/add_chainlink_data_streams_oracle) for the injective-core dependency is problematic because:
- Branch references are mutable and can change unexpectedly
- This breaks build reproducibility
- Not suitable for production or release candidates
- Makes debugging and auditing difficult
🔎 Recommended fix
Use either:
- A tagged release once the branch is merged (preferred):
- git_repo: https://github.com/InjectiveLabs/injective-core
- branch: c-655/add_chainlink_data_streams_oracle
+ tag: v1.18.0 # or appropriate version
subdir: proto- A specific commit SHA for immutability:
- git_repo: https://github.com/InjectiveLabs/injective-core
- branch: c-655/add_chainlink_data_streams_oracle
+ commit: <full-40-char-sha>
subdir: protoCommittable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In buf.gen.yaml around lines 32–33, the dependency currently points to a mutable
branch (c-655/add_chainlink_data_streams_oracle); replace this with an immutable
reference by using either a released tag (preferred) or a specific commit SHA
for the injective-core dependency. Update the branch field to the chosen
immutable identifier (tag or commit SHA), regenerate any buf/lock/CI artifacts
(run your buf/bazel/npm regen or lockfile update steps) and verify builds to
ensure reproducibility.
| eip712_domain = EIP712Domain( | ||
| name="Injective Protocol", | ||
| version="2.0.0", | ||
| chainId=888, | ||
| verifyingContract="0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC", | ||
| salt=HexBytes("0x0000000000000000000000000000000000000000000000000000000000000000"), | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for chainId references
echo "=== Searching for chainId references ==="
rg -n "chainId" --type py -C 2
echo ""
echo "=== Searching for verifyingContract references ==="
rg -n "verifyingContract" --type py -C 2
echo ""
echo "=== Searching for EIP712Domain usage ==="
rg -n "EIP712Domain" --type py -C 3
echo ""
echo "=== Searching for network or environment configuration ==="
rg -n "MAINNET|TESTNET|DEVNET|network" --type py | head -30
echo ""
echo "=== Checking orderhash.py file context ==="
cat -n pyinjective/orderhash.py | head -60Repository: InjectiveLabs/sdk-python
Length of output: 11373
🏁 Script executed:
#!/bin/bash
# Check the build_eip712_msg function and how it uses the network parameter
echo "=== Checking build_eip712_msg function ==="
sed -n '70,120p' pyinjective/orderhash.py
echo ""
echo "=== Check if there are any related issues or TODOs ==="
rg -n "TODO|FIXME|XXX|HACK" pyinjective/orderhash.py -C 2
echo ""
echo "=== Check for any test files related to orderhash ==="
fd -e py "orderhash" tests/
echo ""
echo "=== Check if chainId=888 appears in tests ==="
rg -n "888" --type py | grep -E "(test_|orderhash)" | head -20Repository: InjectiveLabs/sdk-python
Length of output: 3024
🏁 Script executed:
#!/bin/bash
# Check the test_orderhash.py file
echo "=== Full test_orderhash.py file ==="
cat -n tests/test_orderhash.py
echo ""
echo "=== Check Network class to see what chain IDs are available ==="
rg -n "class Network" pyinjective/core/ -A 20 | head -80
echo ""
echo "=== Check if there's documentation about chainId=888 ==="
fd -e md -e txt -e rst . | xargs grep -l "888\|chainId" 2>/dev/null | head -10Repository: InjectiveLabs/sdk-python
Length of output: 4246
🏁 Script executed:
#!/bin/bash
# Get the chain_id values used in Network class
echo "=== Check Network devnet chain_id ==="
rg -n "devnet\|testnet\|mainnet" pyinjective/core/network.py -A 5 | head -100
echo ""
echo "=== Look for static Network factory methods ==="
rg -n "def devnet|def testnet|def mainnet" pyinjective/core/network.py -A 10 | head -100
echo ""
echo "=== Check what chain_id value is used in Network initialization ==="
rg -n "chain_id.*=" pyinjective/core/network.py | head -20Repository: InjectiveLabs/sdk-python
Length of output: 2033
🏁 Script executed:
#!/bin/bash
# Let's verify the numeric chain IDs and understand the pattern
echo "=== Summary of chain_ids ==="
grep -n "chain_id=" pyinjective/core/network.py | grep -E "(devnet|testnet|mainnet)"
echo ""
echo "=== Check if chainId in EIP712Domain should be numeric or string ==="
rg -n "chainId" --type py -B 2 -A 2
echo ""
echo "=== Verify that network parameter is passed but not used in orderhash ==="
sed -n '58,85p' pyinjective/orderhash.pyRepository: InjectiveLabs/sdk-python
Length of output: 5583
🏁 Script executed:
#!/bin/bash
# Extract numeric chain IDs from network definitions
echo "=== Extract numeric chain IDs from network string values ==="
grep "chain_id=" pyinjective/core/network.py | grep -E "injective-[0-9]" | sed 's/.*injective-//' | sed 's/".*//'
echo ""
echo "=== Verify the relationship between string chain_ids and numeric chainId ==="
echo "devnet: chain_id='injective-777' -> numeric chainId should be 777"
echo "testnet: chain_id='injective-888' -> numeric chainId should be 888"
echo "mainnet: chain_id='injective-1' -> numeric chainId should be 1"
echo ""
echo "Current hardcoded value in orderhash.py: chainId=888 (testnet only)"
echo ""
echo "=== Check if network parameter contains chain_id information ==="
grep -n "self.chain_id" pyinjective/core/network.py | head -5
</parameter>Repository: InjectiveLabs/sdk-python
Length of output: 713
🏁 Script executed:
#!/bin/bash
# Confirm the issue: network parameter has chain_id but it's not used in orderhash
echo "=== Check if OrderHashManager stores network for later use ==="
sed -n '65,105p' pyinjective/orderhash.py
echo ""
echo "=== Confirm that network.chain_id is available but not used ==="
echo "Network object has chain_id attribute (line 132 in network.py)"
echo "But build_eip712_msg function doesn't accept or use network parameter"
grep -n "def build_eip712_msg" pyinjective/orderhash.py -A 15Repository: InjectiveLabs/sdk-python
Length of output: 2487
Make EIP712 domain configuration network-aware instead of hardcoded.
The chainId=888 in the EIP712Domain is hardcoded to testnet, but the SDK supports multiple networks (devnet with chain_id="injective-777", testnet with chain_id="injective-888", mainnet with chain_id="injective-1"). The network parameter passed to OrderHashManager contains the correct chain ID but is never stored or used—it's only used to fetch endpoint URLs. This causes orders hashed on devnet or mainnet to have incorrect EIP712 domain values. Extract the numeric chain ID from the network parameter and pass it to the EIP712Domain construction.
🤖 Prompt for AI Agents
In pyinjective/orderhash.py around lines 21 to 27, the EIP712Domain is using a
hardcoded chainId=888; instead, store the incoming network parameter on the
OrderHashManager instance and derive the numeric chain ID from it (e.g., parse
digits from "injective-777"/"injective-888"/"injective-1" or use a
network.chain_id property if present) and pass that numeric value into
EIP712Domain.chainId so the domain matches devnet/testnet/mainnet.
| from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_iam__policy__pb2 | ||
| from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if vendored policy_pb2.py exists at the expected location
echo "=== Checking for vendored policy_pb2.py ==="
fd -t f "policy_pb2.py" pyinjective/proto/google/iam/v1/
# Check project dependencies for google-iam packages
echo -e "\n=== Checking project dependencies ==="
fd -t f "(requirements|setup|pyproject)" . | head -5 | while read f; do
echo "--- File: $f ---"
cat "$f" 2>/dev/null | rg -i "google.*iam|grpc.*iam" || echo "(no matches)"
doneRepository: InjectiveLabs/sdk-python
Length of output: 290
🏁 Script executed:
#!/bin/bash
# Look at the actual imports in the target file
echo "=== Imports in iam_policy_pb2_grpc.py (lines 1-20) ==="
head -20 pyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.py
# Look at the corresponding pb2 file
echo -e "\n=== Imports in iam_policy_pb2.py (lines 1-20) ==="
head -20 pyinjective/proto/google/iam/v1/iam_policy_pb2.py
# Check if policy_pb2.py exists
echo -e "\n=== Checking for policy_pb2.py files ==="
find pyinjective/proto -name "policy_pb2.py" -type fRepository: InjectiveLabs/sdk-python
Length of output: 2041
🏁 Script executed:
#!/bin/bash
# Examine broader import patterns in the proto directory
echo "=== Sample imports from other proto files in the same location ==="
fd -t f "\.py$" pyinjective/proto/google/iam/v1/ | head -5 | while read f; do
echo "--- File: $(basename $f) ---"
head -15 "$f" | rg "^from|^import" || true
done
# Check the general structure of vendored proto imports
echo -e "\n=== Sample imports from other google proto directories ==="
fd -t f "\.py$" pyinjective/proto/google/api/ | head -3 | while read f; do
echo "--- File: $(basename $f) ---"
head -15 "$f" | rg "^from|^import" || true
doneRepository: InjectiveLabs/sdk-python
Length of output: 2192
Inconsistent import paths - these should use vendored modules if available locally.
The gRPC stub file imports from google.iam.v1 directly, but policy_pb2.py and iam_policy_pb2.py are vendored locally at pyinjective/proto/google/iam/v1/. The corresponding pb2 file inconsistently uses vendored paths for google.api.* modules while importing google.iam.v1.* from external packages.
Since both files are generated (marked "DO NOT EDIT"), the imports need to be corrected at generation time. Regenerate using protoc configuration that consistently uses vendored import paths:
from pyinjective.proto.google.iam.v1 import iam_policy_pb2 as ...
from pyinjective.proto.google.iam.v1 import policy_pb2 as ...🤖 Prompt for AI Agents
In pyinjective/proto/google/iam/v1/iam_policy_pb2_grpc.py around lines 5 to 6,
the file imports google.iam.v1 modules from the external package instead of the
vendored local protobufs; regenerate or reconfigure protoc to use the local
vendored import paths so the lines become imports from
pyinjective.proto.google.iam.v1 (e.g., update protoc --proto_path and/or
python_out/import_prefix settings or the generation plugin options) ensuring
both iam_policy_pb2 and policy_pb2 are referenced via
pyinjective.proto.google.iam.v1 to match the vendored pb2 files.
Solves C-655
Summary by CodeRabbit
New Features
Improvements
Updates
✏️ Tip: You can customize this high-level summary in your review settings.